package com.elitel.frame.base.service.strategy.service;

import lombok.extern.slf4j.Slf4j;

import java.util.HashMap;
import java.util.Map;
import java.util.Optional;

@Slf4j
public class BuildServiceFactory {

    private static final Map<String, BuildServiceStrategy> STRATEGY_MAP = new HashMap<>();

    public static void register(String markType, BuildServiceStrategy strategy) {
        STRATEGY_MAP.put(markType, strategy);
    }

    public static BuildServiceStrategy getStrategyNoNull(String markType) {
        return STRATEGY_MAP.get(Optional.ofNullable(markType).orElse(""));
    }
}
